import matplotlib.pyplot as plt
import numpy as np
from scipy import signal

ws = np.linspace(-10, 10, 256)

num = np.array([1, 2])
den = np.array([1, 4, 3])

w, h = signal.freqs(num, den, worN=ws)



plt.rcParams['font.sans-serif'] = ['SimHei']  # 加上这一句就能在图表中显示中文
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号


plt.subplot(211)
plt.plot(w, np.abs(h))
plt.ylabel('幅频')


plt.subplot(212)
plt.plot(w, np.angle(h))
plt.ylabel('相频')


plt.xlabel(r'$\omega$')
plt.show()
